using MediatR;
using B.S.RbacData.ErrorCode;
using System.ComponentModel.DataAnnotations;

namespace SupplierCustomerManagement.Write.API.Applications.Commands.customers
{
    /// <summary>
    /// 修改客户命令
    /// </summary>
    public class UpdateCustomerCommand : IRequest<ApiResult<bool>>
    {
        /// <summary>
        /// 客户ID
        /// </summary>
        [Required(ErrorMessage = "客户ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 客户编号
        /// </summary>
        [Required(ErrorMessage = "客户编号不能为空")]
        [StringLength(50, ErrorMessage = "客户编号长度不能超过50个字符")]
        public string CustomerCode { get; set; } = string.Empty;

        /// <summary>
        /// 客户名称
        /// </summary>
        [Required(ErrorMessage = "客户名称不能为空")]
        [StringLength(200, ErrorMessage = "客户名称长度不能超过200个字符")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 客户类型（个人/企业）
        /// </summary>
        [Required(ErrorMessage = "客户类型不能为空")]
        [StringLength(20, ErrorMessage = "客户类型长度不能超过20个字符")]
        public string Type { get; set; } = string.Empty;

        /// <summary>
        /// 助记码
        /// </summary>
        [StringLength(50, ErrorMessage = "助记码长度不能超过50个字符")]
        public string? MnemonicCode { get; set; }

        /// <summary>
        /// 负责人姓名
        /// </summary>
        [StringLength(100, ErrorMessage = "负责人姓名长度不能超过100个字符")]
        public string? ContactPersonName { get; set; }

        /// <summary>
        /// 负责人电话
        /// </summary>
        [StringLength(20, ErrorMessage = "负责人电话长度不能超过20个字符")]
        public string? ContactPersonPhone { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [StringLength(18, ErrorMessage = "身份证号长度不能超过18个字符")]
        public string? IdCard { get; set; }

        /// <summary>
        /// 统一社会信用代码
        /// </summary>
        [StringLength(18, ErrorMessage = "统一社会信用代码长度不能超过18个字符")]
        public string? UnifiedSocialCreditCode { get; set; }

        /// <summary>
        /// 所属行业
        /// </summary>
        [StringLength(100, ErrorMessage = "所属行业长度不能超过100个字符")]
        public string? Industry { get; set; }

        /// <summary>
        /// 客户阶段
        /// </summary>
        [StringLength(50, ErrorMessage = "客户阶段长度不能超过50个字符")]
        public string? CustomerStage { get; set; }

        /// <summary>
        /// 客户自定义标签
        /// </summary>
        [StringLength(200, ErrorMessage = "客户自定义标签长度不能超过200个字符")]
        public string? CustomTags { get; set; }

        /// <summary>
        /// 意向产品
        /// </summary>
        [StringLength(200, ErrorMessage = "意向产品长度不能超过200个字符")]
        public string? IntendedProduct { get; set; }

        /// <summary>
        /// 合作日期
        /// </summary>
        public DateTime? CooperationDate { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        [StringLength(50, ErrorMessage = "省份长度不能超过50个字符")]
        public string? Province { get; set; }

        /// <summary>
        /// 城市
        /// </summary>

        public string? City { get; set; }

        /// <summary>
        /// 区县
        /// </summary>
        [StringLength(50, ErrorMessage = "区县长度不能超过50个字符")]
        public string? District { get; set; }

        /// <summary>
        /// 详细地址
        /// </summary>
        [StringLength(200, ErrorMessage = "详细地址长度不能超过200个字符")]
        public string? DetailedAddress { get; set; }

        /// <summary>
        /// 上级客户ID
        /// </summary>
        public int? SuperiorCustomerId { get; set; }

        /// <summary>
        /// 客户级别
        /// </summary>
        public int? CustomerLevel { get; set; }

        /// <summary>
        /// 所属市场
        /// </summary>
        [StringLength(100, ErrorMessage = "所属市场长度不能超过100个字符")]
        public string? AffiliatedMarket { get; set; }

        /// <summary>
        /// 服务人员
        /// </summary>
        [StringLength(100, ErrorMessage = "服务人员长度不能超过100个字符")]
        public string? ServicePersonnel { get; set; }

        /// <summary>
        /// 使用状态（启用/停用）
        /// </summary>
        [Required(ErrorMessage = "使用状态不能为空")]
        [StringLength(20, ErrorMessage = "使用状态长度不能超过20个字符")]
        public string Status { get; set; } = "启用";

        /// <summary>
        /// 是否归档
        /// </summary>
        public bool IsArchived { get; set; } = false;

        /// <summary>
        /// 录入单位
        /// </summary>
        [Required(ErrorMessage = "录入单位不能为空")]
        [StringLength(100, ErrorMessage = "录入单位长度不能超过100个字符")]
        public string EntryUnit { get; set; } = string.Empty;

        /// <summary>
        /// 使用单位
        /// </summary>
        [Required(ErrorMessage = "使用单位不能为空")]
        [StringLength(100, ErrorMessage = "使用单位长度不能超过100个字符")]
        public string UsageUnit { get; set; } = string.Empty;

        /// <summary>
        /// 修改人ID
        /// </summary>
        public int? UpdatedBy { get; set; }
    }
}
